from OpenNero import *
import time
import random
import math
import action_script
from Queue import Queue
from constants import *

class RoombaBrain(AgentBrain):
    """
    A uniform random baseline - a very simple agent
    """
    def __init__(self):
        AgentBrain.__init__(self) # have to make this call
        
    def initialize(self, init_info):
        """
        create a new agent
        """
        self.action_info = init_info.actions
        print "possible action: "
        print init_info.actions
        return True
    def start(self, time, observations):
        """
        return first action given the first observations
        """
        return self.action_info.random()
    def reset(self):
        pass
    def act(self, time, observations, reward):
        """
        return an action given the reward for the previous action and the new observations
        """
        action = self.action_info.random()
        print action
        return action
    def end(self, time, reward):
        """
        receive the reward for the last observation
        """
        reward_string = str(reward)
        fitness_string = str(self.fitness)
        #print  "Final reward: %f, cumulative: %f" % reward, self.fitness
        print "Final reward: " + reward_string + ", cumulative: " + fitness_string
        return True
                             
    def destroy(self):
        """
        called when the agent is done
        """
        return True
